#pragma once
#include <middleware/gm_api/skfapi.h>
#include <middleware/apdu/apdu.def/apdu_datatypes.h>
//#define SM4_ENC_GROUP_LEN 16
#include <middleware/apdu/apdu.lib/apdu_lib_common.h>
class gm_stream_mgr
{
public:
	gm_stream_mgr(void);
	~gm_stream_mgr(void);

public:
	BYTE *init(ULONG ulHeaderLen, int ngroupalglen = 16);

	BYTE *pop_data(int nlen = 0);

	ULONG get_data_len();

	BYTE *push_data(BYTE *pbData, ULONG ndatalen);

	long	increase( long size );

	BYTE * get_data_ptr();

	ULONG get_block_data_len();

	void release();

	void  set_max_apdu_len(ULONG maxLen);

private:
	BYTE * _pRemainData;
	BYTE * _pHeader;
	BYTE * _pEndle;
	ULONG _ulTotallen;
	ULONG _block_size;
	ULONG _max_apdu_len;
};
